package com.company.cuobuliao.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Oreo on 2017/3/1.
 */

public class BaseFragment extends Fragment {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public String getTime() {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
        Date curDate = new Date(System.currentTimeMillis());//获取当前时间
        return formatter.format(curDate);
    }


    private static long lastClickTime = 0L;

    public static boolean filterClick(String longTime) {
        long SELECT_INTERVAL;
        if (longTime != null) {
            SELECT_INTERVAL = Long.parseLong(longTime);
        } else {
            SELECT_INTERVAL = 500L;
        }
        long time = System.currentTimeMillis();
        if (time - lastClickTime < SELECT_INTERVAL) {
            return false;
        } else {
            lastClickTime = time;
            return true;
        }
    }
}
